<?php


namespace App\Http\Controllers\admin;


use App\Dao\AdminDao;
use App\Exceptions\SysExceptions;
use App\Http\Controller;
use App\Services\Code;
use App\Validate\Logic\AdminLogic;
use Illuminate\Contracts\View\Factory;
use Illuminate\View\View;

/**
 * Class Login
 * @package App\Http\Controllers\admin
 * author:fhc
 * desc:登录控制器
 * created_at: 2020/10/16{
 */
class LoginController extends Controller
{
    /**
     * author:fhc
     * desc:登录页面
     * created_at: 2020/10/16{
     * @param AdminLogic $logic
     * @return array|Factory|View
     * @throws SysExceptions
     */
    public function login(AdminLogic $logic){
        if(isPost()){
            $params = request()->all();
            $logic->login($params);
            return Code::message('登录成功',200,AdminDao::login($params));
        }
        return view('admin.login');
    }


}
